const { defineConfig } = require('@vue/cli-service')
const { name } = require('./package');
const path = require('path')

module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    port: 8083, // 本地开发端口保持不变
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
    static: {
      directory: path.join(__dirname, 'dist'),
      publicPath: '/'
    }
  },
  publicPath: process.env.NODE_ENV === 'production' 
    ? '//localhost:6088/'  // 生产环境使用nginx端口
    : '//localhost:8083/', // 开发环境保持原端口
  configureWebpack: {
    output: {
      publicPath: process.env.NODE_ENV === 'production' 
        ? '//localhost:6088/'  // 同步修改输出路径
        : '//localhost:8083/',
      library: `${name}-[name]`,
      libraryTarget: 'umd',
      chunkLoadingGlobal: `webpackJsonp_${name}`,
    },
  }
})